using System;
using UnityEngine;
using Voodoo.Sauce.Internal.CrossPromo.Models;

namespace Voodoo.Sauce.Internal.CrossPromo.Mobile
{
	internal static class MobileCrossPromoWrapper
	{
		public static bool IsAppInstalled(GameToPromote game)
		{
			AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
			AndroidJavaObject @static = androidJavaClass.GetStatic<AndroidJavaObject>("currentActivity");
			AndroidJavaObject androidJavaObject = @static.Call<AndroidJavaObject>("getPackageManager", new object[0]);
			try
			{
				return androidJavaObject.Call<AndroidJavaObject>("getLaunchIntentForPackage", new object[1]
				{
					game.bundle_id
				}) != null;
			}
			catch (Exception)
			{
				return false;
			}
		}
	}
}
